'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 军团
 * @author sundbcn@gmail.com (sun debing)
 */

var dataApi = require('../libs/dataApi');

exports.getUnionGroupConf = function (union_level) {
    return _getUnionGroupConf(union_level);
};

/**
 * 获取军团成员数量
 * @param  {[type]} union_level [description]
 * @return {[type]}             [description]
 */
exports.getUnionMemberLimitNum = function (union_level) {
    var union_conf = _getUnionGroupConf(union_level);
    return union_conf.members;
};

/**
 * 获取军团每日金币贡献上限
 * @param  {[type]} union_level [description]
 * @return {[type]}             [description]
 */
exports.getUnionGroupDonateGoldLimit = function (union_level) {
    var union_conf = _getUnionGroupConf(union_level);
    return union_conf.contribute_gold;
};

/**
 * 获取军团每日钻石贡献上限
 * @param  {[type]} union_level [description]
 * @return {[type]}             [description]
 */
exports.getUnionGroupDonateDiamondLimit = function (union_level) {
    var union_conf = _getUnionGroupConf(union_level);
    return union_conf.contribute_point;
};

/**
 * 获取金币贡献值得比例
 * @param  {[type]} union_level [description]
 * @return {[type]}             [description]
 */
exports.getGoldContributeRatio = function (union_level) {
    var union_conf = _getUnionGroupConf(union_level);
    return union_conf.contribute_gold / union_conf.contribution_value;
};

/**
 * 获取钻石贡献值得比例
 * @param  {[type]} union_level [description]
 * @return {[type]}             [description]
 */
exports.getDiamondContributeRatio = function (union_level) {
    var union_conf = _getUnionGroupConf(union_level);
    return union_conf.contribute_point / union_conf.contribution_value;
};

/**
 * 获取军团副首领数量
 * @param  {[type]} union_level [description]
 * @return {[type]}             [description]
 */
exports.getUnionSecondLeaderLimitNum = function (union_level) {
    var union_conf = _getUnionGroupConf(union_level);
    return union_conf.leader_num;
};

/**
 * 获取军团副首领数量
 * @param  {[type]} union_level [description]
 * @return {[type]}             [description]
 */
exports.getUnionLvExp = function (union_level) {
    var union_conf = _getUnionGroupConf(union_level);
    return union_conf.exp;
};

/**
 * 根据军团等级获取配置
 * @param  {[type]} union_level [description]
 * @return {[type]}             [description]
 */
var _getUnionGroupConf = function (union_level) {
    var union_conf = dataApi.union.findById(union_level);
    return union_conf;
};
